public class ComplexNumber {

    public static void main(String[] args) {
        Complex x = new Complex(1.0 , -2.0);
        Complex y = new Complex(3.0 , 4.0);
        Complex.printSentence(x, y);
    }

	}
	class Complex
	{
    private double a,b;
    Complex(double a,double b)
    {
        this.a = a;
        this.b = b;
    }
    static Complex Add(Complex x,Complex y)
    {
        return new Complex(x.a+y.a, x.b+y.b);
    }
    static Complex Minus(Complex x,Complex y)
    {
        return new Complex(x.a-y.a, x.b-y.b);
    }
    static Complex Multiple(Complex x,Complex y)
    {
        return new Complex(x.a * y.a - x.b * y.b, x.a * y.b + x.b * y.a);
    }
    static Complex Divide(Complex x,Complex y)
    {
        Complex conjugate = new Complex(y.a, -y.b);
        double mo = (y.a)*(y.a) + (y.b)*(y.b);

        Complex t = Multiple(x,conjugate);
        return new Complex(t.a/mo , t.b/mo);
    }
    static String print(Complex x)
    {
        if (x.b > 0)
            return x.a + "+" + x.b + "i";
        else
            return x.a + "-" + (-x.b) + "i";
    }
    static void printSentence(Complex x, Complex y)
    {
        System.out.println("("+ print(x) + ")+("+ print(y) + ") =" +print(Add(x, y)));
        System.out.println("("+ print(x) + ")-("+ print(y) + ") =" +print(Minus(x, y)));
        System.out.println("("+ print(x) + ")*("+ print(y) + ") =" +print(Multiple(x, y)));
        System.out.println("("+ print(x) + ")/("+ print(y) + ") =" +print(Divide(x, y)));
    }

	}